"""
Case Type   : 系统内部使用工具
Case Name   : gs_ctl：指定参数--help,显示命令行参数信息
Create At   : 2022-07-28
Owner       : liu-tong-8848
Description :
    1.执行gs_ctl --help的命令
Expect      :
    1.成功
History     :
"""

import unittest
from testcase.utils.Logger import Logger
from yat.test import Node
from yat.test import macro
import os


class Tools(unittest.TestCase):
    def setUp(self):
        self.logger = Logger()
        self.userNode = Node('PrimaryDbUser')
        self.DB_ENV_PATH = macro.DB_ENV_PATH

    def test_systools(self):
        self.logger.info(f'-----{os.path.basename(__file__)}' + ' start-----')

        text = '--step1:执行gs_ctl --help的命令；expect：成功--'
        self.logger.info(text)
        excute_cmd1 = f'source {self.DB_ENV_PATH};' \
                      f'gs_ctl --help "'
        self.logger.info(excute_cmd1)
        msg1 = self.userNode.sh(excute_cmd1).result()
        self.logger.info(msg1)
        # msg_list = ['-b,  --mode=MODE', '-D, --pgdata=DATADIR',
        #             '-s, --silent', '-t, --timeout=SECS', '-V, --version',
        #             '-w', '-W', '-M', '-T', '-q', '-d', '-L', '-P PASSWORD',
        #             '-U USERNAME', '-Z NODE-TYPE', '-?, -h, --help']
        # for content in msg_list:
        #     self.assertTrue(msg1.find(content) > -1)

    def tearDown(self):
        self.logger.info(
            f'-----{os.path.basename(__file__)}' + ' end-----')
